package com.lin.eat.dao;

import com.lin.eat.entry.Address;
import com.lin.eat.entry.Customer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CustomerMapper {

    int addCustomer(@Param("c_id") String c_id, @Param("c_name") String c_name, @Param("c_phone") String c_phone, @Param("c_password") String c_password, @Param("c_image") String c_image);

    void updateTokenByCid(@Param("c_id") String c_id, @Param("c_token") String c_token);

    int updateTokenByToken(@Param("c_token") String c_token);

    int updateHeadImageByCid(@Param("c_id") String c_id, @Param("c_image") String c_image);

    Customer findCustomerByPP(@Param("c_phone") String c_phone, @Param("c_password") String c_password);

    Customer findCustomerByPhone(@Param("c_phone") String c_phone);

    Customer findCustomerByToken(@Param("c_token") String c_token);

    Customer findCustomerByCid(@Param("c_id") String c_id);

    List<Address> findAddressByCid(@Param("c_id") String c_id);

    Address findDefaultAddressByCid(@Param("c_id") String c_id);

    int updateCustomerInfo(@Param("c_name") String c_name, @Param("c_sex") int c_sex, @Param("c_id") String c_id);

    int addAddress(Address address);

    int addAddressNum(@Param("as_id") String as_id,@Param("ad_id") String ad_id,@Param("as_num") String as_num);

    List<Address> selectAllAddressByCid(@Param("c_id") String c_id);

    List<String> selectAllAddressNumByAdid(@Param("ad_id") String ad_id);

    Address findAddressByInfo(@Param("ad_info") String ad_info);

    int updateAddressInfo(Address address);

    int updateAddressState(@Param("ad_id") String ad_id);

    int setOtherStateZero();

    int deleteAddressNumByAdid(@Param("ad_id") String ad_id);

    int deleteAddress(@Param("ad_id") String ad_id);

}
